package com.example.run.teacherhelper.Fragments;

import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ListView;

import com.example.run.teacherhelper.Activities.DianMingActivity;
import com.example.run.teacherhelper.Adapters.FragmentAdapter;
import com.example.run.teacherhelper.R;
import com.example.run.teacherhelper.module.Student;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by run on 2015/10/17.
 */
public class Class_Info_Fragment extends Fragment {
    private TabLayout mTabs;
    private ViewPager mViewPager;
    private List<Fragment> fragmentList;//碎片列表集合fragment
    private List<String>  messageTabs;
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view=inflater.inflate(R.layout.class_info_fragment,null);
        mTabs=(TabLayout)view.findViewById(R.id.message_tab);
        mViewPager=(ViewPager)view.findViewById(R.id.message_pager);

        initData();//加载数据
        FragmentManager manager=getFragmentManager();
        FragmentAdapter adapter=new FragmentAdapter(manager,fragmentList,messageTabs);
        mViewPager.setAdapter(adapter);
        mTabs.setupWithViewPager(mViewPager);//viewPager与Tabs绑订
        return view;
    }

    protected void initData(){
        fragmentList=new ArrayList<Fragment>();
        for(int i=0;i<7;i++)
        {
            fragmentList.add(new Day_Class_info_Fragment());
        }

        messageTabs=new ArrayList<String>();
        messageTabs.add("一");
        messageTabs.add("二");
        messageTabs.add("三");
        messageTabs.add("四");
        messageTabs.add("五");
        messageTabs.add("六");
        messageTabs.add("日");
    }

}
